package entity.enums;

/**
 * 海康消息类型
 *
 * @author zhouwz
 * @date 2020/8/19 10:44
 */
public enum HikMsgType {
    /**
     * 海康消息类型
     */
    REGISTER_REQ((short) 1, "0x1", (short) 100, "注册 →"),
    REGISTER_RSQ((short) 2, "0x2", (short) 44, "注册 ←"),

    STATUS_REPORT_CONFIG_REQ((short) 256, "0x100", (short) 48, "状态上报配置发"),
    STATUS_REPORT_CONFIG_RSQ((short) 257, "0x101", (short) 40, "状态上报配置"),

    GLOBAL_PRECISION_CONFIG_REQ((short) 258, "0x102", (short) 999, "全局精度配置发"),
    GLOBAL_PRECISION_CONFIG_RSQ((short) 259, "0x103", (short) 999, "全局精度配置"),

    ALARM_CONFIG_REQ((short) 260, "0x104", (short) 999, "告警配置发"),
    ALARM_CONFIG_RSQ((short) 261, "0x105", (short) 999, "告警配置"),

    NTP_TIMING_CONFIG_REQ((short) 262, "0x106", (short) 999, "NTP校时配置发"),
    NTP_TIMING_CONFIG_RSQ((short) 263, "0x107", (short) 999, "NTP校时配置"),

    MOTION_PARAMETER_CONFIG_REQ((short) 264, "0x108", (short) 999, "运动参数配置发"),
    MOTION_PARAMETER_CONFIG_RSQ((short) 265, "0x109", (short) 999, "运动参数配置"),

    SET_PLATFORM_CAPABILITY_REQ((short) 266, "0x10A", (short) 999, "平台能力参数配置发"),
    SET_PLATFORM_CAPABILITY_RSQ((short) 267, "0x10B", (short) 999, "平台能力参数配置"),

    GET_BASE_CAPABILITY_REQ((short) 512, "0x200", (short) 36, "获取基础能力集 ←"),
    GET_BASE_CAPABILITY_RSQ((short) 513, "0x201", (short) 40, "获取基础能力集 →"),

    REPORT_BASE_CAPABILITY_REQ((short) 514, "0x202", (short) 999, "上报基础能力集 →"),
    REPORT_BASE_CAPABILITY_RSQ((short) 515, "0x203", (short) 40, "上报基础能力集 ←"),

    REPORT_NODE_SWITCH_REQ((short) 516, "0x204", (short) 40, "地码上报的开关控制 ←"),
    REPORT_NODE_SWITCH_RSQ((short) 517, "0x205", (short) 40, "地码上报的开关控制 →"),

    REPORT_NODE_REQ((short) 518, "0x206", (short) 76, "地码信息上报 →"),
    REPORT_NODE_RSQ((short) 519, "0x207", (short) 44, "地码信息上报 ←"),

    GET_HARDWARE_OR_SOFTWARE_VERSION_REQ((short) 520, "0x208", (short) 999, "获取设备软硬件版本发"),
    GET_HARDWARE_OR_SOFTWARE_VERSION_RSQ((short) 521, "0x209", (short) 999, "获取设备软硬件版本"),

    REPORT_HARDWARE_OR_SOFTWARE_VERSION_REQ((short) 522, "0x20A", (short) 999, "上报设备软硬件版本发"),
    REPORT_HARDWARE_OR_SOFTWARE_VERSION_RSQ((short) 523, "0x20B", (short) 999, "上报设备软硬件版本"),

    GET_MAINTAIN_INFO_REQ((short) 524, "0x20C", (short) 999, "获取维护信息发"),
    GET_MAINTAIN_INFO_RSQ((short) 525, "0x20D", (short) 999, "获取维护信息"),

    REPORT_MAINTAIN_INFO_REQ((short) 526, "0x20E", (short) 999, "上报维护信息发"),
    REPORT_MAINTAIN_INFO_RSQ((short) 527, "0x20F", (short) 999, "上报维护信息"),

    SET_BATTERY_INFO_REPORT_REQ((short) 528, "0x210", (short) 40, "设置电池信息上报周期发"),
    SET_BATTERY_INFO_REPORT_RSQ((short) 529, "0x211", (short) 40, "设置电池信息上报周期"),

    BATTERY_INFO_REPORT_REQ((short) 530, "0x212", (short) 56, "电池信息上报 →"),
    BATTERY_INFO_REPORT_RSQ((short) 531, "0x213", (short) 44, "电池信息上报 ←"),

    SLAM_LOCATION_INFO_REPORT_REQ((short) 532, "0x214", (short) 999, "SLAM定位信息上报发"),
    SLAM_LOCATION_INFO_REPORT_RSQ((short) 533, "0x215", (short) 999, "SLAM定位信息上报"),

    SET_OBSTACLE_PROFILE_INFO_REPORT_REQ((short) 534, "0x216", (short) 40, "设置障碍物轮廓信息上报的开关发"),
    SET_OBSTACLE_PROFILE_INFO_REPORT_RSQ((short) 535, "0x217", (short) 40, "设置障碍物轮廓信息上报的开关"),

    OBSTACLE_PROFILE_INFO_REPORT_REQ((short) 536, "0x218", (short) 999, "障碍物轮廓信息上报发"),
    OBSTACLE_PROFILE_INFO_REPORT_RSQ((short) 537, "0x219", (short) 999, "障碍物轮廓信息上报发"),

    /**
     * 长度是动态的
     */
    REPORT_DEVICE_STATE_REQ_0((short) 768, "0x300", (short) 140, "设备上报状态(执行机构0) →"),
    REPORT_DEVICE_STATE_REQ_3((short) 768, "0x300", (short) 188, "设备上报状态(执行机构3) →"),
    REPORT_DEVICE_STATE_REQ_4((short) 768, "0x300", (short) 188, "设备上报状态(执行机构4) →"),
    REPORT_DEVICE_STATE_REQ((short) 768, "0x300", (short) 999, "设备上报状态 →"),
    REPORT_DEVICE_STATE_RSQ((short) 769, "0x301", (short) 44, "设备上报状态 ←"),

    EMPTY_RECTILINEAR_MOTION_REQ((short) 770, "0x302", (short) 192, "空车直线移动控制 ←"),
    EMPTY_RECTILINEAR_MOTION_RSQ((short) 771, "0x303", (short) 40, "空车直线移动控制 →"),

    EMPTY_CURVATURE_MOTION_REQ((short) 772, "0x304", (short) 999, "空车弧线移动控制发"),
    EMPTY_CURVATURE_MOTION_RSQ((short) 773, "0x305", (short) 999, "空车弧线移动控制"),

    DETECTION_CONTROL_REQ((short) 774, "0x306", (short) 196, "探测控制 ←"),
    DETECTION_CONTROL_RSQ((short) 775, "0x307", (short) 40, "探测控制 →"),

    RECHARGE_CONTROL_REQ((short) 776, "0x308", (short) 204, "充电控制 ←"),
    RECHARGE_CONTROL_RSQ((short) 777, "0x309", (short) 40, "充电控制 →"),

    PICK_OVERLAY_RECTILINEAR_MOTION_REQ((short) 778, "0x30A", (short) 292, "取货叠加直线移动 ←"),
    PICK_OVERLAY_RECTILINEAR_MOTION_RSQ((short) 779, "0x30B", (short) 40, "取货叠加直线移动 →"),

    RELEASE_OVERLAY_RECTILINEAR_MOTION_REQ((short) 780, "0x30C", (short) 292, "放货叠加直线移动 ←"),
    RELEASE_OVERLAY_RECTILINEAR_MOTION_RSQ((short) 781, "0x30D", (short) 999, "放货叠加直线移动 →"),

    PICK_OVERLAY_CURVATURE_MOTION_REQ((short) 782, "0x30E", (short) 999, "取货叠加弧线移动发"),
    PICK_OVERLAY_CURVATURE_MOTION_RSQ((short) 783, "0x30F", (short) 999, "取货叠加弧线移动"),

    RELEASE_OVERLAY_CURVATURE_MOTION_REQ((short) 784, "0x310", (short) 999, "放货叠加弧线移动发"),
    RELEASE_OVERLAY_CURVATURE_MOTION_RSQ((short) 785, "0x311", (short) 999, "放货叠加弧线移动"),

    ONLY_LIFTING_CONTROL_REQ((short) 786, "0x312", (short) 292, "单独举升控制 ←"),
    ONLY_LIFTING_CONTROL_RSQ((short) 787, "0x313", (short) 40, "单独举升控制 →"),

    ONLY_LOWER_CONTROL_REQ((short) 788, "0x314", (short) 292, "单独下放控制 ←"),
    ONLY_LOWER_CONTROL_RSQ((short) 789, "0x315", (short) 40, "单独下放控制 →"),

    SLAM_NAVIGATE_ONLINE_REQ((short) 790, "0x316", (short) 999, "SLAM导航方式的设备自主上线发"),
    SLAM_NAVIGATE_ONLINE_RSQ((short) 791, "0x317", (short) 999, "SLAM导航方式的设备自主上线"),

    ALT_MAP_REQ((short) 792, "0x318", (short) 999, "切换地图发"),
    ALT_MAP_RSQ((short) 793, "0x319", (short) 999, "切换地图"),

    ALT_MAP_OK_REQ((short) 794, "0x31A", (short) 999, "切换地图成功发"),
    ALT_MAP_OK_RSQ((short) 795, "0x31B", (short) 999, "切换地图成功"),

    req((short) 796, "0x31C", (short) 999, "设备上推无法离线原因发"),
    rsq((short) 797, "0x31D", (short) 999, "设备上推无法离线原因"),

    ALT_NAVIGATION_MODE_REQ((short) 798, "0x31E", (short) 999, "切换导航方式发"),
    ALT_NAVIGATION_MODE_RSQ((short) 799, "0x31F", (short) 999, "切换导航方式"),

    ROLLER_CONTROL_REQ((short) 800, "0x320", (short) 999, "滚筒控制发"),
    ROLLER_CONTROL_RSQ((short) 801, "0x321", (short) 999, "滚筒控制"),

    EMPTY_RECTILINEAR_MOTION_COMPLEX_REQ((short) 802, "0x322", (short) 999, "空车移动控制（复杂路径） ←"),
    EMPTY_RECTILINEAR_MOTION_COMPLEX_RSQ((short) 803, "0x323", (short) 40, "空车移动控制（复杂路径） →"),

    PICK_OVERLAY_CARRY_MOTION_COMPLEX_REQ((short) 804, "0x324", (short) 999, "取货叠加载货运动控制（复杂路径） ←"),
    PICK_OVERLAY_CARRY_MOTION_COMPLEX_RSQ((short) 805, "0x325", (short) 999, "取货叠加载货运动控制（复杂路径） →"),

    RELEASE_OVERLAY_EMPTY_MOTION_COMPLEX_REQ((short) 806, "0x326", (short) 999, "放货叠加空车运动控制（复杂路径）发"),
    RELEASE_OVERLAY_EMPTY_MOTION_COMPLEX_RSQ((short) 807, "0x327", (short) 999, "放货叠加空车运动控制（复杂路径）"),

    EMPTY_MOTION_OVERLAY_PICK_COMPLEX_REQ((short) 808, "0x328", (short) 999, "空车移动叠加取货控制（复杂路径）发"),
    EMPTY_MOTION_OVERLAY_PICK_COMPLEX_RSQ((short) 809, "0x329", (short) 999, "空车移动叠加取货控制（复杂路径）"),

    PICK_MOTION_OVERLAY_RELEASE_COMPLEX_REQ((short) 810, "0x32A", (short) 999, "载货移动叠加放货控制（复杂路径）发"),
    PICK_MOTION_OVERLAY_RELEASE_COMPLEX_RSQ((short) 811, "0x32B", (short) 999, "载货移动叠加放货控制（复杂路径）"),

    CHARGE_COMPLEX_REQ((short) 812, "0x32C", (short) 999, "充电（复杂路径）发"),
    CHARGE_COMPLEX_RSQ((short) 813, "0x32D", (short) 999, "充电（复杂路径）"),

    DETECT_COMPLEX_REQ((short) 814, "0x32E", (short) 999, "探测（复杂路径）发"),
    DETECT_COMPLEX_RSQ((short) 815, "0x32F", (short) 999, "探测（复杂路径）"),

    SLAM_NAVIGATE_ONLINE_COMPLEX_REQ((short) 816, "0x330", (short) 999, "SLAM导航设备自主上线（复杂路径）发"),
    SLAM_NAVIGATE_ONLINE_COMPLEX_RSQ((short) 817, "0x331", (short) 999, "SLAM导航设备自主上线（复杂路径）"),

    FORCED_LIFTING_OR_LOWER_REQ((short) 1792, "0x700", (short) 40, "强制举升/下放货架控制 ←"),
    FORCED_LIFTING_OR_LOWER_RSQ((short) 1793, "0x701", (short) 40, "强制举升/下放货架控制 →"),

    DEVICE_SPACE_LOCK_REQ((short) 2048, "0x800", (short) 64, "设备申请空间锁定 →"),
    DEVICE_SPACE_LOCK_RSQ((short) 2049, "0x801", (short) 40, "设备申请空间锁定 ←"),

    SPACE_RELEASE_REQ((short) 2050, "0x802", (short) 999, "申请空间释放 →"),
    SPACE_RELEASE_RSQ((short) 2051, "0x803", (short) 999, "申请空间释放 ←"),

    FULL_MAINTENANCE_REQ((short) 2052, "0x804", (short) 999, "申请充满维护发"),
    FULL_MAINTENANCE_RSQ((short) 2053, "0x805", (short) 999, "申请充满维护"),

    DYNAMIC_OBSTACLE_PATHS_REQ((short) 2058, "0x80A", (short) 999, "动态绕障路径封锁申请发"),
    DYNAMIC_OBSTACLE_PATHS_RSQ((short) 2059, "0x80B", (short) 999, "动态绕障路径封锁申请"),

    PAUSE_CONTROL_REQ((short) 2304, "0x900", (short) 40, "暂停控制 ←"),
    PAUSE_CONTROL_RSQ((short) 2305, "0x901", (short) 40, "暂停控制 →"),

    RESUME_CONTROL_REQ((short) 2306, "0x902", (short) 40, "取消暂停 ←"),
    RESUME_CONTROL_RSQ((short) 2307, "0x903", (short) 40, "取消暂停 →"),

    CANCEL_TASK_REQ((short) 2308, "0x904", (short) 40, "取消任务 ←"),
    CANCEL_TASK_RSQ((short) 2309, "0x905", (short) 40, "取消任务 →"),

    STOP_CONTROL_REQ((short) 2310, "0x906", (short) 40, "停车 ←"),
    STOP_CONTROL_RSQ((short) 2311, "0x907", (short) 40, "停车 →"),

    DISPLAY_PLATFORM_INFO_REQ((short) 2560, "0xA00", (short) 999, "显示平台信息发"),
    DISPLAY_PLATFORM_INFO_RSQ((short) 2561, "0xA01", (short) 999, "显示平台信息"),

    ALARM_VOLUME_CONTROL_REQ((short) 2562, "0xA02", (short) 999, "报警提示音音量控制发"),
    ALARM_VOLUME_CONTROL_RSQ((short) 2563, "0xA03", (short) 999, "报警提示音音量控制"),

    CHARGING_POINT_STATE_REQ((short) 1, "0x7E00", (short) 999, "充电桩上报状态给平台发"),
    CHARGING_POINT_STATE_RSQ((short) 1, "0x7E01", (short) 999, "充电桩上报状态给平台"),

    UPGRADE_REQ((short) 32512, "0x7F00", (short) 999, "升级发"),
    UPGRADE_RSQ((short) 32513, "0x7F01", (short) 999, "升级"),

    UPDATE_FAILED_REQ((short) 32514, "0x7F02", (short) 999, "升级失败发"),
    UPDATE_FAILED_RSQ((short) 32515, "0x7F03", (short) 999, "升级失败"),

    RESOURCES_DOWNLOAD_REQ((short) 32516, "0x7F04", (short) 999, "资源下载发"),
    RESOURCES_DOWNLOAD_RSQ((short) 32517, "0x7F05", (short) 999, "资源下载"),

    RESOURCES_DOWNLOAD_FAILED_REQ((short) 32518, "0x7F06", (short) 999, "资源下载失败发"),
    RESOURCES_DOWNLOAD_FAILED_RSQ((short) 32519, "0x7F07", (short) 999, "资源下载失败"),

    ERROR((short) -1, "-1", (short) 999, "没有该命令类型"),
    ;
    private final Short code;

    private final String hex;

    private final Short len;

    private final String msg;

    HikMsgType(Short code, String hex, Short len, String msg) {
        this.code = code;
        this.hex = hex;
        this.len = len;
        this.msg = msg;
    }

    public Short getCode() {
        return code;
    }

    public String getHex() {
        return hex;
    }

    public Short getLen() {
        return len;
    }

    public String getMsg() {
        return msg;
    }

    public static HikMsgType getHikMsgType(Short code) {
        for (HikMsgType item : HikMsgType.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return RESOURCES_DOWNLOAD_FAILED_RSQ;
    }
}
